package com.woniu.controller;/*
 *
 * @author   米雷
 * @Description  登录注册
 * @Date:create in 11:25 2020-04-07
 *
 * */

import com.woniu.pojo.Users;
import com.woniu.service.UsersService;
import com.woniu.userLog.LogPoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/user")
@Api(tags = "登录注册")
public class LoginController {

    @Autowired
    UsersService usersService;

    @PostMapping("/login")
    @ApiOperation(value = "登录")
    @ResponseBody
    @LogPoint("用户登录")
    public Map Login(String acc, String pwd){
        Map res  =usersService.Login(acc,pwd);
                return res;
    }

    @ResponseBody
    @PostMapping("/register")
    @ApiOperation(value = "注册")
    @LogPoint("用户注册")
    public String register(String acc,String pwd){
        String res=usersService.regist(acc,pwd);
        return res;
    }
}
